Jan-Philipp Kolb
08 April 2016
Rstudio und Rmarkdown
Rstudio und Rmarkdown
Rstudio und knitR
http://wiki.openstreetmap.org/wiki/Overpass_API
url <- "https://raw.githubusercontent.com/Japhilko/
GeoData/master/2015/data/CampSites_Germany.csv"CampSites <- read.csv(url)| X | name | tourism | website |
|---|---|---|---|
| 1 | Campingplatz Winkelbachtal | camp_site | http://www.gruibingen.de/campingplatz.html |
| 2 | Radler-Zeltplatz | camp_site | NA |
| 3 | Campingplatz des Naturfreundehauses | camp_site | NA |
| 4 | Campingplatz Am Aichstruter Stausee | camp_site | NA |
| 5 | NA | camp_site | NA |
| 6 | Kandern | camp_site | NA |
| 7 | Campingplatz Baiersbronn-Obertal | camp_site | NA |
| 8 | Campingplatz SchwabenmĂƒÂ¼hle | camp_site | NA |
library(raster)
DEU1 <- getData('GADM', country='DEU', level=1)library(maptools)
plot(DEU1)plot(DEU1)
points(y=CampSites$lat,x=CampSites$lon,
col="red",pch=20)plot(DEU1)
points(y=CampSites$lat,x=CampSites$lon,col=rgb(0,1,0,.2),
pch=20)library(ggmap)
DE_Map <- qmap("Germany", zoom=6, maptype="hybrid")
DE_MapDE_Map + geom_point(aes(x = lon, y = lat),
data = CampSites)DE_Map + geom_density2d(data = CampSites, aes(x = lon, y = lat),lwd=1.5)DE_Map + stat_density2d(data = CampSites,
aes(x = lon, y = lat,fill = ..level..), bins = 100,
geom = 'polygon')DE_Map + stat_density2d(data=CampSites,
aes(x=lon,y=lat,fill=..level..,
alpha = ..level..),bins=80,geom='polygon')magrittr - fĂ¼r den Pipe Operator in R:
library("magrittr")##
## Attaching package: 'magrittr'
## The following object is masked from 'package:ggmap':
##
## inset
leaflet - um interaktive Karten mit der JavaScript Bibliothek ‘Leaflet’ zu erzeugen
library("leaflet")m <- leaflet() %>%
addTiles() %>%
addMarkers(lng=CampSites$lon,
lat=CampSites$lat,
popup=CampSites$name)
mpopupInfo <- paste(CampSites$name,"\n",CampSites$website)m <- leaflet() %>%
addTiles() %>% # Add default OpenStreetMap map tiles
addMarkers(lng=CampSites$lon,
lat=CampSites$lat,
popup=popupInfo)
mDas Ergebnis ist hier:
Campingplätze in Deutschland
Camping Mannheim
Ich hab die Ergebnisse hochgeladen:
Publizieren auf Rpubs
url <- "https://raw.githubusercontent.com/Japhilko/
GeoData/master/2015/data/whcSites.csv"
whcSites <- read.csv(url) m <- leaflet() %>%
addTiles() %>% # Add default OpenStreetMap map tiles
addMarkers(lng=whcSites$lon,
lat=whcSites$lat,
popup=whcSites$name_en)
mWeltkulturerbestätten
whcSites$color <- "red"
whcSites$color[whcSites$category=="Cultural"] <- "blue"
whcSites$color[whcSites$category=="Mixed"] <- "orange"m1 <- leaflet() %>%
addTiles() %>%
addCircles(lng=whcSites$lon,
lat=whcSites$lat,
popup=whcSites$name_en,
color=whcSites$color)
m1Karte Weltkulturerbe
Als Website speichern
url <- "https://raw.githubusercontent.com/Japhilko/
GeoData/master/2015/data/whcSites.csv"
UNESCO <- read.csv(url)| name_en | latitude | longitude |
|---|---|---|
| Cultural Landscape and Archaeological Remains of the Bamiyan Valley | 34.84694 | 67.82525 |
| Minaret and Archaeological Remains of Jam | 34.39656 | 64.51606 |
| Historic Centres of Berat and Gjirokastra | 40.06944 | 20.13333 |
| Butrint | 39.75111 | 20.02611 |
library(ggmap)
ind <- UNESCO$states_name_en=="Germany"
UNESCO_DE <- UNESCO[ind,]library(ggplot2)
DE_Map + geom_point(aes(x = longitude, y = latitude),
data = UNESCO_DE)library(ggplot2)
DNunesco <- UNESCO_DE[UNESCO_DE$category=="Natural",]
DCunesco <- UNESCO_DE[UNESCO_DE$category=="Cultural",]
Csites <- DE_Map + geom_point(aes(x = longitude,
y = latitude),
data =DCunesco,
col="orange", size= 3)
Nsites <- DE_Map + geom_point(aes(x = longitude,
y = latitude),
data = DNunesco,
col="green", size= 3)